package com.iotteam.androidbase.moudules.test_sensor.sensor_info_page;

import android.graphics.Paint;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.iotteam.androidbase.R;
import com.iotteam.androidbase.base.BaseFragment;
import com.iotteam.androidbase.commen.views.charts.XYChartView;
import com.iotteam.androidbase.commen.views.charts.line.Data;
import com.iotteam.androidbase.commen.views.charts.line.Line;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by vonchenchen on 13/08/2017.
 */

public class DayInfoPageFragment extends BaseFragment {

    protected View mRootView;

    private XYChartView mXYChartView;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if(mRootView == null) {
            mRootView = inflater.inflate(R.layout.fragment_day_page, container, false);
        }

        mXYChartView = (XYChartView) mRootView.findViewById(R.id.view_chart);

        List<Data> dataLine = new ArrayList<>();
        dataLine.add(new Data(0, 0));
        dataLine.add(new Data(1, 5));
        dataLine.add(new Data(2, 8));
        dataLine.add(new Data(3, 20));
        dataLine.add(new Data(4, 7));

        Paint paint = new Paint();
        paint.setStyle(Paint.Style.FILL);
        paint.setTextAlign(Paint.Align.CENTER);
        paint.setColor(0xffff0000);

        Line line = new Line(dataLine);
        line.setPaint(paint);

        mXYChartView.addLine("base", line);

        return mRootView;
    }

    @Override
    protected void lazyLoad() {

    }
}
